package gimys;

public class AlphaAgro {
	protected float alphaAgro = 1.0f;
	int direction = -1;
	float deltaGlow = 0.001f;
	int lastTime = 0;
	
	public AlphaAgro(float alphaAgro) {
		super();
		this.alphaAgro = alphaAgro;
	}

	float glow(int time){
		alphaAgro = alphaAgro + direction*deltaGlow*(time-lastTime);
		lastTime = time;
		if (alphaAgro > 1.0f){
			direction = -direction;
			alphaAgro = 1.0f;
		}else if(alphaAgro < 0f){
			direction = -direction;
			alphaAgro = 0f;			
		}
		return alphaAgro;
	}
	
}
